home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 June: Reference Library / Dev.CD Jun 95 / Dev.CD Jun 95.toast / What's New? / Tool Chest / Interfaces / UniversalInterfaces 2.1B1 / AIncludes / Events.a < prev    next >
Encoding:
Text File  |  1995-04-18  |  8.7 KB  |  400 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Events.a
  3. ;
  4. ;    Contains:    Event Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.1ß1.1 in “MPW Prerelease” on ETO #17
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__EVENTS__') = 'UNDEFINED' THEN
  21. __EVENTS__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  25.     include 'Types.a'
  26.     ENDIF
  27. ;        include 'ConditionalMacros.a'                                ;
  28.  
  29.     IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
  30.     include 'Quickdraw.a'
  31.     ENDIF
  32. ;        include 'MixedMode.a'                                        ;
  33. ;        include 'QuickdrawText.a'                                    ;
  34.  
  35.     IF &TYPE('__OSUTILS__') = 'UNDEFINED' THEN
  36.     include 'OSUtils.a'
  37.     ENDIF
  38. ;        include 'Memory.a'                                            ;
  39. ; typedef UInt16             MacOSEventKind
  40.  
  41. nullEvent                        EQU        0
  42. mouseDown                        EQU        1
  43. mouseUp                            EQU        2
  44. keyDown                            EQU        3
  45. keyUp                            EQU        4
  46. autoKey                            EQU        5
  47. updateEvt                        EQU        6
  48. diskEvt                            EQU        7
  49. activateEvt                        EQU        8
  50. osEvt                            EQU        15
  51.  
  52. ; typedef UInt16             MacOSEventMask
  53.  
  54. mDownMask                        EQU        $0002                ; mouse button pressed 
  55. mUpMask                            EQU        $0004                ; mouse button released 
  56. keyDownMask                        EQU        $0008                ; key pressed 
  57. keyUpMask                        EQU        $0010                ; key released 
  58. autoKeyMask                        EQU        $0020                ; key repeatedly held down 
  59. updateMask                        EQU        $0040                ; window needs updating 
  60. diskMask                        EQU        $0080                ; disk inserted 
  61. activMask                        EQU        $0100                ; activate/deactivate window 
  62. highLevelEventMask                EQU        $0400                ; high-level events (includes AppleEvents) 
  63. osMask                            EQU        $8000                ; operating system events (suspend, resume) 
  64. everyEvent                        EQU        $FFFF                ; all of the above 
  65.  
  66. ; event message equates 
  67. charCodeMask                    EQU        $000000FF
  68. keyCodeMask                        EQU        $0000FF00
  69. adbAddrMask                        EQU        $00FF0000
  70. osEvtMessageMask                EQU        $FF000000
  71. ; OS event messages.  Event (sub)code is in the high byte of the message field. 
  72. mouseMovedMessage                EQU        $00FA
  73. suspendResumeMessage            EQU        $0001
  74. resumeFlag                        EQU        1                    ; Bit 0 of message indicates resume vs suspend 
  75. convertClipboardFlag            EQU        2                    ; Bit 1 in resume message indicates clipboard change 
  76.  
  77. ; typedef UInt16             MacOSEventModifiers
  78.  
  79. ; modifiers 
  80. activeFlag                        EQU        $0001                ; Bit 0 of modifiers for activateEvt and mouseDown events 
  81. btnState                        EQU        $0080                ; Bit 7 of low byte is mouse button state 
  82. cmdKey                            EQU        $0100                ; Bit 0 of high byte 
  83. shiftKey                        EQU        $0200                ; Bit 1 of high byte 
  84. alphaLock                        EQU        $0400                ; Bit 2 of high byte 
  85. optionKey                        EQU        $0800                ; Bit 3 of high byte 
  86. controlKey                        EQU        $1000                ; Bit 4 of high byte 
  87. rightShiftKey                    EQU        $2000                ; Bit 5 of high byte 
  88. rightOptionKey                    EQU        $4000                ; Bit 6 of high byte 
  89. rightControlKey                    EQU        $8000                ; Bit 7 of high byte 
  90.  
  91. EventRecord             RECORD    0
  92. what                     ds.w   1        ; offset: $0 (0)
  93. message                     ds.l   1        ; offset: $2 (2)
  94. when                     ds.l   1        ; offset: $6 (6)
  95. where                     ds     Point    ; offset: $A (10)
  96. modifiers                 ds.w   1        ; offset: $E (14)
  97. sizeof                     EQU *            ; size:   $10 (16)
  98.                         ENDR
  99.  
  100. ; typedef struct EventRecord  EventRecord
  101. KeyMap                     RECORD    0
  102. map                         ds.b   16        ; offset: $0 (0)
  103. sizeof                     EQU *            ; size:   $10 (16)
  104.                         ENDR
  105.  
  106. EvQEl                     RECORD    0
  107. qLink                     ds.l   1        ; offset: $0 (0)
  108. qType                     ds.w   1        ; offset: $4 (4)
  109. evtQWhat                 ds.w   1        ; offset: $6 (6)        ; this part is identical to the EventRecord as... 
  110. evtQMessage                 ds.l   1        ; offset: $8 (8)        ; defined above 
  111. evtQWhen                 ds.l   1        ; offset: $C (12)
  112. evtQWhere                 ds     Point    ; offset: $10 (16)
  113. evtQModifiers             ds.w   1        ; offset: $14 (20)
  114. sizeof                     EQU *            ; size:   $16 (22)
  115.                         ENDR
  116.  
  117. ; typedef struct EvQEl         EvQEl
  118. ; typedef EvQEl             *EvQElPtr
  119. ; typedef GetNextEventFilterUPP  GNEFilterUPP
  120. ;
  121. ; pascal UInt32 GetCaretTime(void)
  122. ;
  123.     IF ¬ GENERATINGCFM THEN
  124.         Macro
  125.         _GetCaretTime        &dest=(sp)
  126.         move.l               $02F4,&dest
  127.         EndM
  128.     ELSE
  129.         IMPORT_CFM_FUNCTION    GetCaretTime
  130.     ENDIF
  131.  
  132. ;
  133. ; pascal void SetEventMask(MacOSEventMask value)
  134. ;
  135.     IF ¬ GENERATINGCFM THEN
  136.         Macro
  137.         _SetEventMask        &src=(sp)+
  138.         move.w               &src,$0144
  139.         EndM
  140.     ELSE
  141.         IMPORT_CFM_FUNCTION    SetEventMask
  142.     ENDIF
  143.  
  144. ;
  145. ; pascal MacOSEventMask GetEventMask(void)
  146. ;
  147.     IF ¬ GENERATINGCFM THEN
  148.         Macro
  149.         _GetEventMask        &dest=(sp)
  150.         move.w               $0144,&dest
  151.         EndM
  152.     ELSE
  153.         IMPORT_CFM_FUNCTION    GetEventMask
  154.     ENDIF
  155.  
  156. ;
  157. ; pascal QHdrPtr GetEvQHdr(void)
  158. ;
  159.     IF ¬ GENERATINGCFM THEN
  160.         Macro
  161.         _GetEvQHdr
  162.             dc.w     $2EBC
  163.             dc.w     $0000
  164.             dc.w     $014A
  165.         EndM
  166.     ELSE
  167.         IMPORT_CFM_FUNCTION    GetEvQHdr
  168.     ENDIF
  169.  
  170. ; InterfaceLib exports GetEvQHdr, so make GetEventQueue map to that 
  171. ;
  172. ; pascal UInt32 GetDblTime(void)
  173. ;
  174.     IF ¬ GENERATINGCFM THEN
  175.         Macro
  176.         _GetDblTime          &dest=(sp)
  177.         move.l               $02F0,&dest
  178.         EndM
  179.     ELSE
  180.         IMPORT_CFM_FUNCTION    GetDblTime
  181.     ENDIF
  182.  
  183. ; InterfaceLib exports GetDblTime, so make GetDoubleClickTime map to that 
  184. ;
  185. ; pascal Boolean GetNextEvent(MacOSEventMask eventMask, EventRecord *theEvent)
  186. ;
  187.     IF ¬ GENERATINGCFM THEN
  188.         _GetNextEvent:    OPWORD    $A970
  189.     ELSE
  190.         IMPORT_CFM_FUNCTION    GetNextEvent
  191.     ENDIF
  192.  
  193. ;
  194. ; pascal Boolean WaitNextEvent(MacOSEventMask eventMask, EventRecord *theEvent, UInt32 sleep, RgnHandle mouseRgn)
  195. ;
  196.     IF ¬ GENERATINGCFM THEN
  197.         _WaitNextEvent:    OPWORD    $A860
  198.     ELSE
  199.         IMPORT_CFM_FUNCTION    WaitNextEvent
  200.     ENDIF
  201.  
  202. ;
  203. ; pascal Boolean EventAvail(MacOSEventMask eventMask, EventRecord *theEvent)
  204. ;
  205.     IF ¬ GENERATINGCFM THEN
  206.         _EventAvail:    OPWORD    $A971
  207.     ELSE
  208.         IMPORT_CFM_FUNCTION    EventAvail
  209.     ENDIF
  210.  
  211. ;
  212. ; pascal void GetMouse(Point *mouseLoc)
  213. ;
  214.     IF ¬ GENERATINGCFM THEN
  215.         _GetMouse:    OPWORD    $A972
  216.     ELSE
  217.         IMPORT_CFM_FUNCTION    GetMouse
  218.     ENDIF
  219.  
  220. ;
  221. ; pascal Boolean Button(void)
  222. ;
  223.     IF ¬ GENERATINGCFM THEN
  224.         _Button:    OPWORD    $A974
  225.     ELSE
  226.         IMPORT_CFM_FUNCTION    Button
  227.     ENDIF
  228.  
  229. ;
  230. ; pascal Boolean StillDown(void)
  231. ;
  232.     IF ¬ GENERATINGCFM THEN
  233.         _StillDown:    OPWORD    $A973
  234.     ELSE
  235.         IMPORT_CFM_FUNCTION    StillDown
  236.     ENDIF
  237.  
  238. ;
  239. ; pascal Boolean WaitMouseUp(void)
  240. ;
  241.     IF ¬ GENERATINGCFM THEN
  242.         _WaitMouseUp:    OPWORD    $A977
  243.     ELSE
  244.         IMPORT_CFM_FUNCTION    WaitMouseUp
  245.     ENDIF
  246.  
  247. ;
  248. ; pascal void GetKeys(KeyMap theKeys)
  249. ;
  250.     IF ¬ GENERATINGCFM THEN
  251.         _GetKeys:    OPWORD    $A976
  252.     ELSE
  253.         IMPORT_CFM_FUNCTION    GetKeys
  254.     ENDIF
  255.  
  256. ;
  257. ; pascal UInt32 KeyTranslate(const void *transData, UInt16 keycode, UInt32 *state)
  258. ;
  259.     IF ¬ GENERATINGCFM THEN
  260.         _KeyTranslate:    OPWORD    $A9C3
  261.     ELSE
  262.         IMPORT_CFM_FUNCTION    KeyTranslate
  263.     ENDIF
  264.  
  265. ;
  266. ; pascal UInt32 TickCount(void)
  267. ;
  268.     IF ¬ GENERATINGCFM THEN
  269.         _TickCount:    OPWORD    $A975
  270.     ELSE
  271.         IMPORT_CFM_FUNCTION    TickCount
  272.     ENDIF
  273.  
  274. ;
  275. ; pascal OSErr PostEvent(MacOSEventKind eventNum, UInt32 eventMsg)
  276. ;
  277.     IF ¬ GENERATINGCFM THEN
  278.         ; parameters: 
  279.         ;     eventNum          => A0
  280.         ;     eventMsg          => D0
  281.         ; returns: 
  282.         ;     OSErr             <= D0
  283.         _PostEvent:    OPWORD    $A02F
  284.     ELSE
  285.         IMPORT_CFM_FUNCTION    PostEvent
  286.     ENDIF
  287.  
  288. ;
  289. ; pascal OSErr PPostEvent(MacOSEventKind eventCode, UInt32 eventMsg, EvQElPtr *qEl)
  290. ;
  291.     IF ¬ GENERATINGCFM THEN
  292.         ; parameters: 
  293.         ;     eventCode         => A0
  294.         ;     eventMsg          => D0
  295.         ;     qEl               => A1
  296.         ; returns: 
  297.         ;     OSErr             <= D0
  298.         Macro
  299.         _PPostEvent
  300.             dc.w     $A12F
  301.             dc.w     $2288
  302.         EndM
  303.     ELSE
  304.         IMPORT_CFM_FUNCTION    PPostEvent
  305.     ENDIF
  306.  
  307. ;
  308. ; pascal Boolean OSEventAvail(MacOSEventMask mask, EventRecord *theEvent)
  309. ;
  310.     IF ¬ GENERATINGCFM THEN
  311.         ; parameters: 
  312.         ;     mask              => D0
  313.         ;     theEvent          => A0
  314.         ; returns: 
  315.         ;     Boolean           <= D0
  316.         Macro
  317.         _OSEventAvail
  318.             dc.w     $A030
  319.             dc.w     $5240
  320.         EndM
  321.     ELSE
  322.         IMPORT_CFM_FUNCTION    OSEventAvail
  323.     ENDIF
  324.  
  325. ;
  326. ; pascal Boolean GetOSEvent(MacOSEventMask mask, EventRecord *theEvent)
  327. ;
  328.     IF ¬ GENERATINGCFM THEN
  329.         ; parameters: 
  330.         ;     mask              => D0
  331.         ;     theEvent          => A0
  332.         ; returns: 
  333.         ;     Boolean           <= D0
  334.         Macro
  335.         _GetOSEvent
  336.             dc.w     $A031
  337.             dc.w     $5240
  338.         EndM
  339.     ELSE
  340.         IMPORT_CFM_FUNCTION    GetOSEvent
  341.     ENDIF
  342.  
  343. ;
  344. ; pascal void FlushEvents(MacOSEventMask whichMask, MacOSEventMask stopMask)
  345. ;
  346.     IF ¬ GENERATINGCFM THEN
  347.         Macro
  348.         _FlushEvents
  349.             dc.w     $201F
  350.             dc.w     $A032
  351.         EndM
  352.     ELSE
  353.         IMPORT_CFM_FUNCTION    FlushEvents
  354.     ENDIF
  355.  
  356. ;
  357. ; pascal void SystemClick(const EventRecord *theEvent, WindowPtr theWindow)
  358. ;
  359.     IF ¬ GENERATINGCFM THEN
  360.         _SystemClick:    OPWORD    $A9B3
  361.     ELSE
  362.         IMPORT_CFM_FUNCTION    SystemClick
  363.     ENDIF
  364.  
  365. ;
  366. ; pascal void SystemTask(void)
  367. ;
  368.     IF ¬ GENERATINGCFM THEN
  369.         _SystemTask:    OPWORD    $A9B4
  370.     ELSE
  371.         IMPORT_CFM_FUNCTION    SystemTask
  372.     ENDIF
  373.  
  374. ;
  375. ; pascal Boolean SystemEvent(const EventRecord *theEvent)
  376. ;
  377.     IF ¬ GENERATINGCFM THEN
  378.         _SystemEvent:    OPWORD    $A9B2
  379.     ELSE
  380.         IMPORT_CFM_FUNCTION    SystemEvent
  381.     ENDIF
  382.  
  383.     IF OLDROUTINENAMES  THEN
  384.  
  385. networkEvt                        EQU        10
  386. driverEvt                        EQU        11
  387. app1Evt                            EQU        12
  388. app2Evt                            EQU        13
  389. app3Evt                            EQU        14
  390. app4Evt                            EQU        15
  391. networkMask                        EQU        $0400
  392. driverMask                        EQU        $0800
  393. app1Mask                        EQU        $1000
  394. app2Mask                        EQU        $2000
  395. app3Mask                        EQU        $4000
  396. app4Mask                        EQU        $8000
  397.  
  398.     ENDIF
  399.     ENDIF ; __EVENTS__
  400.